import csv


name_list = []
for i in range(10):
    name_dict = {}
    name_dict['name'] = 'thomas' + str(i)
    name_dict['url'] = 'http://' + str(i)
    name_dict['star'] = '6.' + str(i)
    name_list.append(name_dict)
print(name_list)

with open('./douban_top/' + 'democsv.csv', 'w') as f:
    w = csv.DictWriter(f, fieldnames=['name', 'url', 'star'])
    w.writeheader()
    for i in name_list:
        w.writerows([i])